﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Example4_Camera.Model
{
    
    class Level
    {
        /// <summary>
        /// different tile types are represented by enum
        /// if the tile has state I normally use a class instead
        /// </summary>
        public enum Tile
        {
            T_EMPTY = 0,
            T_BLOCKED,
            T_TRAP
        };

        //width and heigt
        public const int g_levelWidth  = 100;
        public const int g_levelHeight = 20;

        //the 2D array of tiles
        internal Tile[,] m_tiles = new Tile[g_levelWidth, g_levelHeight];

        internal Level()
        {
            GenerateLevel();
        }

        private void GenerateLevel()
        {
            Random rand = new Random();
            for (int x = 0; x < g_levelWidth; x++)
            {
                for (int y = 0; y < g_levelHeight; y++)
                {
                    m_tiles[x, y] = Tile.T_EMPTY; //set every tile to empty
                    
                    //Add some random blockes
                    if (rand.Next(10) == 0)
                    {
                        m_tiles[x, y] = Tile.T_BLOCKED;
                    }
                }


                if (rand.Next(5) == 0)
                {
                    //set bottom tiles to blocked
                    m_tiles[x, g_levelHeight - 1] = Tile.T_BLOCKED;
                }
                else
                {
                    m_tiles[x, g_levelHeight - 1] = Tile.T_TRAP;
                }
            }

            

            
        }
    }
}
